//
//  YWLogin.m
//  网易新闻
//
//  Created by Yeewii@hotmail.com on 16/6/21.
//  Copyright © 2016年 Yeewii@hotmail.com. All rights reserved.
//

#import "YWLogin.h"
#import "AppDelegate+WXHandle.h"
@implementation YWLogin


+(void)openWeChat:(loginBlock)block
{
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(no:) name:kUserMessageNotification object:self];
    SendAuthReq* req =[[SendAuthReq alloc ] init];
    req.scope = @"snsapi_userinfo,snsapi_base";
    req.state = @"0744" ;
    
     if (![WXApi isWXAppInstalled] || ![WXApi isWXAppSupportApi])
     {
         [WXApi sendAuthReq:req viewController:[self getRootViewController] delegate:nil];
     }
        [WXApi sendReq:req];
}
+(UIViewController *)getRootViewController
{
    return [[UIApplication sharedApplication].windows lastObject].rootViewController;
}
-(void)dealloc
{
    NSLog(@"deaddasdadasdsd1111");
}
+(void)no:(NSNotification *)noti
{
    NSLog(@"%@",noti.userInfo);
}


@end
